package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.ConsultantLevel;
import com.sfzy.mapper.ConsultantLevelMapper;
import com.sfzy.service.ConsultantLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultantLevelServiceImpl implements ConsultantLevelService {
    @Autowired
    private ConsultantLevelMapper consultantLevelMapper;
    @Override
    public int insertConsultantLevel(ConsultantLevel consultantLevel) {
        return consultantLevelMapper.insertConsultantLevel(consultantLevel);
    }

    @Override
    public int deleteConsultantLevel(int id) {
        return consultantLevelMapper.deleteConsultantLevel(id);
    }

    @Override
    public int updateConsultantLevel(ConsultantLevel consultantLevel) {
        return consultantLevelMapper.updateConsultantLevel(consultantLevel);
    }

    @Override
    public ConsultantLevel selectConsultantLevel(int id) {
        return consultantLevelMapper.selectConsultantLevel(id);
    }

    @Override
    public PageInfo<ConsultantLevel> selectAllConsultantLevel(ConsultantLevel consultantLevel, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ConsultantLevel> consultantLevels = consultantLevelMapper.selectAllConsultantLevel(consultantLevel);
        PageInfo<ConsultantLevel> pageInfo = new PageInfo<>(consultantLevels);
        return pageInfo;
    }
}
